﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<BathroomLocator.Services.Models.UserPermissions>>" %>

<asp:Content ID="userPermissionsTitle" ContentPlaceHolderID="TitleContent" runat="server">
    User Permissions</asp:Content>
<asp:Content ID="userPermissionsContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        User Permissions</h2>
    <p>
        Select what content type can access each user.
    </p>
    <table>
        <tr>
            <th>
                User
            </th>
            <th>
                Tables
            </th>
            <th>
                Blobs
            </th>
        </tr>
        <%
            foreach (var item in Model)
            {
                var actionUrl = this.Url.Action("SetUserPermissions", new { user = "_user_", useTables = "_useTables_", useBlobs = "_useBlobs_" });
        %>
        <tr>
            <td>
                <%: item.User %>
            </td>
            <td>
                <input id="Tables_<%= item.User %>" onclick="EnableContent('<%= item.User %>', '<%= actionUrl %>')"
                    type="checkbox" <%= item.TablesUsage ? "checked=\"yes\"" : string.Empty %> />
            </td>
            <td>
                <input id="Blobs_<%= item.User %>" onclick="EnableContent('<%= item.User %>', '<%= actionUrl %>')"
                    type="checkbox" <%= item.BlobsUsage ? "checked=\"yes\"" : string.Empty %> />
            </td>
        </tr>
        <% } %>
    </table>
</asp:Content>
